<!DOCTYPE HTML>
<html>

<head>
    <title>Rose</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <style>
        body {
            margin: 0;
            padding: 0;
            overflow: hidden;
        }

        .main {
            /* display: flex;
            align-items: center; */
        }

        .photos {
            position: absolute;
            top: 180px;
            left: 600px;
            width: 150px;
            height: 200px;

            transform-style: preserve-3d;
            /*设置3d环境*/
            perspective: 800px;
            /*设置景深为800px*/
        }

        .photos img {
            width: 150px;
            height: 200px;
            position: absolute;
            box-shadow: 0 0 8px #eaeaea;
            box-shadow: 1px -1px 6px #666;
            border-radius: 4px;
            /*-webkit-box-reflect: below 3px -webkit-linear-gradient(top, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.5));*/
            cursor: pointer;
        }

        .photos .bott {
            width: 1200px;
            height: 1200px;
            border-radius: 50%;
            position: absolute;
            top: 102%;
            left: 50%;
            margin-left: -600px;
            margin-top: -600px;
            transform: rotateX(90deg);
            background: -webkit-radial-gradient(center center, 600px 600px, rgba(158, 158, 222, 0.5), rgba(0, 0, 0, 0));
        }

        .main .preview {
            width: 100%;
            height: 100%;
            background-size: contain;
            background-color: rgba(112, 112, 112, 10);
            background-repeat: no-repeat;
            position: absolute;
            left: 50%;
            opacity: 0.5;
            top: 0;
            display: none;
        }

        #c {
            position: absolute;
            top: 50%;
            left: 50%;
            margin-left: -300px;
            margin-top: -300px;
        }
    </style>
</head>

<body>
    <div class="main">
        <div class="switch">开灯</div>
        <div class="photos">
            <img src="images/m-left.jpg">
            <img src="images/m-right.jpg">
            <img src="images/m-left.jpg">
            <img src="images/m-right.jpg">
            <img src="images/m-left.jpg">
            <img src="images/m-right.jpg">
            <img src="images/m-left.jpg">
            <img src="images/m-right.jpg">
            <canvas id="c"></canvas>
            <div class="bott"></div>
        </div>
        <div class="preview"></div>
    </div>
    <script>
        var b = document.body;
        var c = document.getElementsByTagName('canvas')[0];
        var a = c.getContext('2d');
        document.body.clientWidth;  
    </script>
    <script>
        with (m = Math) C = cos, S = sin, P = pow, R = random; c.width = c.height = f = 600; h = -250; function p(a, b, c) { if (c > 60) return [S(a * 7) * (13 + 5 / (.2 + P(b * 4, 4))) - S(b) * 50, b * f + 50, 625 + C(a * 7) * (13 + 5 / (.2 + P(b * 4, 4))) + b * 400, a * 1 - b / 2, a]; A = a * 2 - 1; B = b * 2 - 1; if (A * A + B * B < 1) { if (c > 37) { n = (j = c & 1) ? 6 : 4; o = .5 / (a + .01) + C(b * 125) * 3 - a * 300; w = b * h; return [o * C(n) + w * S(n) + j * 610 - 390, o * S(n) - w * C(n) + 550 - j * 350, 1180 + C(B + A) * 99 - j * 300, .4 - a * .1 + P(1 - B * B, -h * 6) * .15 - a * b * .4 + C(a + b) / 5 + P(C((o * (a + 1) + (B > 0 ? w : -w)) / 25), 30) * .1 * (1 - B * B), o / 1e3 + .7 - o * w * 3e-6] } if (c > 32) { c = c * 1.16 - .15; o = a * 45 - 20; w = b * b * h; z = o * S(c) + w * C(c) + 620; return [o * C(c) - w * S(c), 28 + C(B * .5) * 99 - b * b * b * 60 - z / 2 - h, z, (b * b * .3 + P((1 - (A * A)), 7) * .15 + .3) * b, b * .7] } o = A * (2 - b) * (80 - c * 2); w = 99 - C(A) * 120 - C(b) * (-h - c * 4.9) + C(P(1 - b, 7)) * 50 + c * 2; z = o * S(c) + w * C(c) + 700; return [o * C(c) - w * S(c), B * 99 - C(P(b, 7)) * 50 - c / 3 - z / 1.35 + 450, z, (1 - b / 1.2) * .9 + a * .1, P((1 - b), 20) / 4 + .05] } } setInterval('for(i=0;i<1e4;i++)if(s=p(R(),R(),i%46/.74)){z=s[2];x=~~(s[0]*f/z-h);y=~~(s[1]*f/z-h);if(!m[q=y*f+x]|m[q]>z)m[q]=z,a.fillStyle="rgb("+~(s[3]*h)+","+~(s[4]*h)+","+~(s[3]*s[3]*-80)+")",a.fillRect(x,y,1,1)}', 0)
    </script>
    <script>
        var pho = document.getElementsByClassName('photos')[0];
        var images = pho.getElementsByTagName('img');
        var len = images.length;
        var deg = Math.floor(360 / len);
        console.log(len)
        for (var i = 0; i < len; ++i) {
            images[i].style = 'transform: rotateY(' + deg * i + 'deg) translateZ(380px)';
            images[i].addEventListener('click', clickImg);
        }

        var pott = document.getElementsByClassName('bott')[0];
        var x = 0;
        // var runner = setInterval(() => {
        //     var yr = (x++) * 0.2;
        //     pho.style.transform = "rotateX(-10deg) rotateY(" + yr + "deg";
        // }, 30);

        var preview = document.getElementsByClassName('preview')[0];

        function clickImg(e) {
            // var target = e.target;
            // var src = target.getAttribute('src');
            // console.log(src);
            // clearInterval(runner);
            // preview.style.backgroundImage = 'url(' + src + ')';
            // preview.style.display = 'block';
        }
    </script>
</body>

</html>